package web.fabrimind.mwm.service.impl;

import java.util.List;
import web.fabrimind.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import web.fabrimind.mwm.mapper.MaterialInboundMapper;
import web.fabrimind.mwm.domain.MaterialInbound;
import web.fabrimind.mwm.service.IMaterialInboundService;

/**
 * 物料入库Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-26
 */
@Service
public class MaterialInboundServiceImpl implements IMaterialInboundService 
{
    @Autowired
    private MaterialInboundMapper materialInboundMapper;

    /**
     * 查询物料入库
     * 
     * @param inboundId 物料入库主键
     * @return 物料入库
     */
    @Override
    public MaterialInbound selectMaterialInboundByInboundId(Long inboundId)
    {
        return materialInboundMapper.selectMaterialInboundByInboundId(inboundId);
    }

    /**
     * 查询物料入库列表
     * 
     * @param materialInbound 物料入库
     * @return 物料入库
     */
    @Override
    public List<MaterialInbound> selectMaterialInboundList(MaterialInbound materialInbound)
    {
        return materialInboundMapper.selectMaterialInboundList(materialInbound);
    }

    /**
     * 新增物料入库
     * 
     * @param materialInbound 物料入库
     * @return 结果
     */
    @Override
    public int insertMaterialInbound(MaterialInbound materialInbound)
    {
        materialInbound.setCreateTime(DateUtils.getNowDate());
        return materialInboundMapper.insertMaterialInbound(materialInbound);
    }

    /**
     * 修改物料入库
     * 
     * @param materialInbound 物料入库
     * @return 结果
     */
    @Override
    public int updateMaterialInbound(MaterialInbound materialInbound)
    {
        materialInbound.setUpdateTime(DateUtils.getNowDate());
        return materialInboundMapper.updateMaterialInbound(materialInbound);
    }

    /**
     * 批量删除物料入库
     * 
     * @param inboundIds 需要删除的物料入库主键
     * @return 结果
     */
    @Override
    public int deleteMaterialInboundByInboundIds(Long[] inboundIds)
    {
        return materialInboundMapper.deleteMaterialInboundByInboundIds(inboundIds);
    }

    /**
     * 删除物料入库信息
     * 
     * @param inboundId 物料入库主键
     * @return 结果
     */
    @Override
    public int deleteMaterialInboundByInboundId(Long inboundId)
    {
        return materialInboundMapper.deleteMaterialInboundByInboundId(inboundId);
    }
}
